<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <p>侦听器的应用场景：数据变化时执行异步或开销比较大的操作</p>
        <div>{{date | dateformat('yyyy-MM-dd')}}</div>
    </div>
</body>
<script src="js/vue.js"></script>
<script>
    //  过滤器

    Vue.filter('dateformat',function(val,arg1){
        if(arg1 == 'yyyy-MM-dd'){
            var ret = ''
            ret += val.getFullYear()
            return ret
        }
    });
    var vm = new Vue({
        el:'#app',
        data:{
            msg:'orange',
            num:100,
            uName:'',
            date:new Date(),
            tip:''
        },
        methods: {

        },
        watch: {


        },
        filters:{
            upper:function(val){
                return val.charAt(0).toUpperCase()+val.slice(1);

            }
        }
    })

</script>
</html>